Skip to content

apollo_network_benchmark: add ReveresedSqmrSender struct and implementation#11554

Open
sirandreww-starkware wants to merge 1 commit into01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enumfrom
01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation
Open

apollo_network_benchmark: add ReveresedSqmrSender struct and implementation#11554
sirandreww-starkware wants to merge 1 commit into01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enumfrom
01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation

Conversation

@sirandreww-starkware
Copy link
Contributor

@sirandreww-starkware sirandreww-starkware commented Jan 8, 2026

Note

Medium Risk
Adds new stateful async sending behavior for the reversed-sqmr benchmark protocol, which could change stress-test traffic patterns and introduce subtle timing issues (timeouts/query replacement), but is confined to benchmarking code.

Overview
Adds a new MessageSender::ReveresedSqmr variant backed by ReveresedSqmrSender, which tracks the latest incoming SQMR server query and replies to it with outgoing broadcast messages.

send_message now supports this mode by opportunistically polling for new queries (short timeout), replacing the active query, and sending responses with improved info/trace/error logging; protocol channel registration for reversed-sqmr remains todo!().

Written by Cursor Bugbot for commit 4541183. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

sirandreww-starkware commented Jan 8, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale label Feb 8, 2026
@github-actions github-actions bot closed this Feb 16, 2026
break;
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one query stored despite broadcast-to-all intent

Medium Severity

collect_new_queries replaces active_query each iteration, so only the most recent query is retained and all prior queries are silently dropped. The comment on line 143 says "broadcast the message to all active queries," and the method is named broadcast_to_queries (plural), but the struct only holds a single Option — meaning in a multi-receiver benchmark scenario, only the last peer to connect actually receives data. If broadcasting to all connected peers is intended, active_query needs to be a collection.

Additional Locations (1)

Fix in Cursor Fix in Web

@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enum branch from a86c6c8 to b16cd92 Compare February 16, 2026 09:10
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation branch from 471fd3f to a929882 Compare February 16, 2026 09:10
@github-actions github-actions bot removed the stale label Feb 17, 2026
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation branch from a929882 to a354cd2 Compare February 19, 2026 07:24
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enum branch from b16cd92 to 55e1b2d Compare February 19, 2026 07:24
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

break;
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1ms timeout per send inflates benchmark latency metrics

Medium Severity

collect_new_queries uses a tokio::time::timeout of 1ms in its while loop. When no queries are pending (the common steady-state case), the final iteration always blocks for 1ms before the timeout fails and the loop exits. Since collect_new_queries is called on every send_message invocation, this adds at least 1ms of artificial latency to every send. In a stress test benchmark, this caps throughput at ~1000 msg/s and inflates the BROADCAST_MESSAGE_SEND_DELAY_SECONDS metric recorded by the caller, producing misleading benchmark results.

Fix in Cursor Fix in Web

}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent message drop when no active query exists

Medium Severity

broadcast_to_queries silently discards the message when active_query is None — no warning or error is logged. The caller in handlers.rs unconditionally increments BROADCAST_MESSAGE_COUNT and records send delay after calling send_message, so dropped messages are counted as successfully sent. This produces inaccurate benchmark metrics. The other protocol variants either panic or log errors on failure, making this inconsistency especially easy to miss during debugging.

Fix in Cursor Fix in Web

@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation branch from a354cd2 to a153019 Compare February 19, 2026 08:04
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enum branch from 55e1b2d to 8067a3e Compare February 19, 2026 08:04
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmrsender_struct_and_implementation branch from a153019 to 4541183 Compare March 16, 2026 15:13
@sirandreww-starkware sirandreww-starkware force-pushed the 01-08-apollo_network_benchmark_add_reveresedsqmr_variant_to_networkprotocol_enum branch from 8067a3e to 4015380 Compare March 16, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants